﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebChatApplication.Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="<%= ResolveClientUrl("~/scripts/jquery-1.7.1.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveClientUrl("~/scripts/jquery.signalR.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveClientUrl("~/signalr/hubs") %>"></script>
    <script type="text/javascript">
        $(document).ready(function () {

            var chat = $.connection.chat;

            $("#sendButton").click(function () {
                chat.send($('#msg').val());
            });


            chat.addMessage = function (message) {
                $('#messages').append('<li>' + message + '</li>');
            };

            $.connection.hub.start();
        });
    </script>
</head>
<body>
    <h2>
        Welcome to SignalR!
    </h2>
    
    <div>
        <input type="text" id="msg" />
        <input type="button" id="sendButton" value="Chat" />
        <ul id="messages">
        </ul>
    </div>
    
</body>
</html>
